<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/6/7
 * Time: 15:43
 */

namespace app\home\controller;


use app\common\controller\HomeBase;
use think\Db;
use think\Request;

class ReadArticle extends HomeBase
{
    public function index()
    {
        $category_id = Request::instance()->param('category');
        $article_id  = Request::instance()->param('article_id');
        //栏目信息
        $category          = Db::name('category')
            ->field('type')
            ->where('id', $category_id)
            ->find();
        //文章信息
        if ($category['type'] == 1)
        {
            Db::name('article')
                ->where('id', $article_id)
                ->setInc('hits', 1);
        } else {
            Db::name('pages')
                ->where('id', $article_id)
                ->setInc('hits', 1);
        }
        return true;
    }

    //空操作
    public function _empty($name)
    {
        return view('/public/404');
    }
}